Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Tencent/tinker into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oneliang committed Nov 29, 2016
2 parents a0eb75e + 86c0d45 commit 8e80773
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class BasePatchInternal {
protected static final String RES_META_FILE = ShareConstants.RES_META_FILE;

protected static final int TYPE_DEX = ShareConstants.TYPE_DEX;
protected static final int TYPE_DEX_FOR_ART = ShareConstants.TYPE_DEX_FOR_ART;
protected static final int TYPE_Library = ShareConstants.TYPE_LIBRARY;
protected static final int TYPE_RESOURCE = ShareConstants.TYPE_RESOURCE;

Expand Down Expand Up @@ -89,7 +88,7 @@ public static boolean extract(ZipFile zipFile, ZipEntry entryFile, File extractT
}

public static int getMetaCorruptedCode(int type) {
if (type == TYPE_DEX || type == TYPE_DEX_FOR_ART) {
if (type == TYPE_DEX) {
return ShareConstants.ERROR_PACKAGE_CHECK_DEX_META_CORRUPTED;
} else if (type == TYPE_Library) {
return ShareConstants.ERROR_PACKAGE_CHECK_LIB_META_CORRUPTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ protected static boolean tryRecoverDexFiles(Tinker manager, ShareSecurityCheck c
private static boolean patchDexExtractViaDexDiff(Context context, String patchVersionDirectory, String meta, final File patchFile, final boolean isUpgradePatch) {
String dir = patchVersionDirectory + "/" + DEX_PATH + "/";

int dexType = ShareTinkerInternals.isVmArt() ? TYPE_DEX_FOR_ART : TYPE_DEX;
if (!extractDexDiffInternals(context, dir, meta, patchFile, dexType, isUpgradePatch)) {
if (!extractDexDiffInternals(context, dir, meta, patchFile, TYPE_DEX, isUpgradePatch)) {
TinkerLog.w(TAG, "patch recover, extractDiffInternals fail");
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static boolean isTinkerPatchServiceRunning(Context context) {
return false;
}
try {
// ActivityManagergetRunningAppProcesses()
// ActivityManager getRunningAppProcesses()
List<ActivityManager.RunningAppProcessInfo> appProcessList = am
.getRunningAppProcesses();

Expand Down Expand Up @@ -122,7 +122,7 @@ private static String getServiceProcessName(Context context, Class<? extends Ser
ServiceInfo serviceInfo;
try {
serviceInfo = packageManager.getServiceInfo(component, 0);
} catch (PackageManager.NameNotFoundException ignored) {
} catch (Throwable ignored) {
// Service is disabled.
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public static void installDexes(Application application, PathClassLoader loader,
}
//install done
sPatchDexCount = files.size();
Log.i(TAG, "after loaded classloader: " + classLoader + ", dex size:" + sPatchDexCount);

if (!checkDexInstall(classLoader)) {
//reset patch dex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public void onFailed(File dexFile, File optimizedDir, Throwable thr) {
ShareIntentUtil.setIntentReturnCode(intentResult, ShareConstants.ERROR_LOAD_PATCH_VERSION_DEX_LOAD_EXCEPTION);
return false;
}
Log.i(TAG, "after loaded classloader: " + application.getClassLoader().toString());

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,10 @@ public class ShareConstants {
public static final int TYPE_PATCH_FILE = 1;
public static final int TYPE_PATCH_INFO = 2;
public static final int TYPE_DEX = 3;
/**
* for art small dex
*/
public static final int TYPE_DEX_FOR_ART = 4;
public static final int TYPE_DEX_OPT = 5;
public static final int TYPE_LIBRARY = 6;
public static final int TYPE_RESOURCE = 7;

public static final int TYPE_DEX_OPT = 4;
public static final int TYPE_LIBRARY = 5;
public static final int TYPE_RESOURCE = 6;


public static final int TINKER_DISABLE = 0x00;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ public static String getTypeString(int type) {
switch (type) {
case ShareConstants.TYPE_DEX:
return "dex";
case ShareConstants.TYPE_DEX_FOR_ART:
return "dex_art";
case ShareConstants.TYPE_DEX_OPT:
return "dex_opt";
case ShareConstants.TYPE_LIBRARY:
Expand Down Expand Up @@ -282,6 +280,9 @@ public static boolean isInMainProcess(Context context) {

public static void killAllOtherProcess(Context context) {
final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (am == null) {
return;
}
// NOTE: getRunningAppProcess() ONLY GIVE YOU THE PROCESS OF YOUR OWN PACKAGE IN ANDROID M
// BUT THAT'S ENOUGH HERE
for (ActivityManager.RunningAppProcessInfo ai : am.getRunningAppProcesses()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

package com.tencent.tinker.build.gradle.task

import com.tencent.tinker.build.auxiliaryclass.AuxiliaryClassInjector
import com.tencent.tinker.build.gradle.TinkerPatchPlugin
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction


/**
* The configuration properties.
*
Expand Down

0 comments on commit 8e80773

Please sign in to comment.