Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
zjutyujf committed Nov 27, 2017
2 parents 259a26a + 9089985 commit 7de5c34
Show file tree
Hide file tree
Showing 318 changed files with 5,264 additions and 12,487 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Atlas

[![license](http://img.shields.io/badge/license-Apache2.0-brightgreen.svg?style=flat)](https://github.com/alibaba/atlas/blob/master/LICENSE)
[![Release Version](https://img.shields.io/badge/release-5.0.7-yellow.svg)](https://github.com/alibaba/atlas/releases)
[![Release Version](https://img.shields.io/badge/atlas_core-5.0.7.55-orange.svg)]()
[![Release Version](https://img.shields.io/badge/atlasupdate-1.1.4.14-blue.svg)]()
[![Release Version](https://img.shields.io/badge/atlasplugin-2.3.3.rc41-green.svg)]()

> A powerful Android Dynamic Component Framework.
Expand Down Expand Up @@ -40,7 +42,7 @@ You can see there were three main library in this project ([atlas-core](./atlas-

## Support
----------
Atlas support all Android version from Android 4.0 to 7.0.
Atlas support all Android version from Android 4.0 to 8.0.

Follow is support status.

Expand All @@ -54,6 +56,7 @@ ART | 5.0 | Yes
ART | 5.1 | Yes
ART | M | Yes
ART | N | Yes
ART | 8.0 | Yes

<!--## Contributing
Expand Down
7 changes: 6 additions & 1 deletion atlas-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {
group = 'com.taobao.android'
description = """atlas_core"""
String postFix = mini=='true' ? "-mini" : "";
version "5.0.7.52${postFix}-SNAPSHOT"
version "5.0.7.55${postFix}"

String getEnvValue(key, defValue) {
def val = System.getProperty(key);
Expand All @@ -49,6 +49,11 @@ targetCompatibility = 1.7

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
provided ('com.android.support:support-v4:25.3.1'){
transitive = true
}
provided 'com.android.support:support-annotations:24.1.1'

}

tasks.whenTaskAdded {task ->
Expand Down
Binary file modified atlas-core/libs/arm64-v8a/libdexinterpret.so
Binary file not shown.
Binary file modified atlas-core/libs/armeabi-v7a/libdexinterpret.so
Binary file not shown.
Binary file modified atlas-core/libs/armeabi/libdexinterpret.so
Binary file not shown.
Binary file modified atlas-core/libs/mips/libdexinterpret.so
Binary file not shown.
Binary file modified atlas-core/libs/mips64/libdexinterpret.so
Binary file not shown.
Binary file modified atlas-core/libs/x86/libdexinterpret.so
Binary file not shown.
Binary file modified atlas-core/libs/x86_64/libdexinterpret.so
Binary file not shown.
3 changes: 3 additions & 0 deletions atlas-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<service
android:name="com.taobao.android.runtime.Dex2OatService"
android:process=":dex2oat" />
<activity
android:name="android.taobao.atlas.remote.RemoteActivityManager$EmbeddedActivity">
</activity>

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@

import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.List;
Expand Down Expand Up @@ -323,12 +324,32 @@ public void attachBaseContext(){
RuntimeVariables.sDexLoadBooster = mdexLoadBooster;
Log.e("BridgeApplication","length =" + new File(mRawApplication.getApplicationInfo().sourceDir).length());

try {
RuntimeVariables.sDexLoadBooster.getClass().getDeclaredMethod("setVerificationEnabled", boolean.class).invoke(RuntimeVariables.sDexLoadBooster, false);
} catch (Throwable e) {
e.printStackTrace();
if(Build.MANUFACTURER.equalsIgnoreCase("vivo") && Build.VERSION.SDK_INT== 23) {
;
// try {
// File appSGLib = mRawApplication.getDir("SGLib", Context.MODE_PRIVATE);
// File mark = new File(mRawApplication.getFilesDir(), "vivo_appSGLib_mark");
// if (appSGLib.exists() && !mark.exists()) {
// mark.createNewFile();
// File[] files = appSGLib.listFiles();
// for(File file : files){
// if(file.exists() && file.isDirectory() && file.getName().startsWith("app_")){
// deleteDirectory(file);
// }
// }
// }
// }catch(Throwable e){
// e.printStackTrace();
// }
}else{
try {
RuntimeVariables.sDexLoadBooster.getClass().getDeclaredMethod("setVerificationEnabled", boolean.class).invoke(RuntimeVariables.sDexLoadBooster, false);
} catch (Throwable e){
e.printStackTrace();
}
}


if(!TextUtils.isEmpty(mInstalledVersionName)){
RuntimeVariables.sInstalledVersionName = mInstalledVersionName;
}
Expand Down Expand Up @@ -392,7 +413,11 @@ public void attachBaseContext(){
AtlasHacks.ActivityThread$AppBindData_providers.set(mBoundApplication,null);
}
} catch (Exception e) {
throw new RuntimeException(e);
if(e instanceof InvocationTargetException){
throw new RuntimeException(((InvocationTargetException)e).getTargetException());
}else {
throw new RuntimeException(e);
}
}
}

Expand Down Expand Up @@ -461,7 +486,11 @@ public void onLowMemory() {
}

}catch(Throwable e){
throw new RuntimeException(e);
if(e instanceof InvocationTargetException){
throw new RuntimeException(((InvocationTargetException)e).getTargetException());
}else {
throw new RuntimeException(e);
}
}

if(mRealApplication instanceof IMonitor){
Expand All @@ -476,4 +505,5 @@ public void onLowMemory() {

mRealApplication.onCreate();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,52 @@ public boolean isInternalBundle(String bundleName){
}
}

public String getBundleForRemoteFragment(String rFname){
if(mCurrentBundleListing==null || mCurrentBundleListing.getBundles()==null){
return null;
}
Iterator<Map.Entry<String, BundleListing.BundleInfo>> iterator = mCurrentBundleListing.getBundles().entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, BundleListing.BundleInfo> entry = iterator.next();
BundleListing.BundleInfo bundleInfo = entry.getValue();
if(bundleInfo!=null && bundleInfo.remoteFragments!=null && bundleInfo.remoteFragments.containsKey(rFname)) {
return bundleInfo.getPkgName();
}
}

return null;
}

public String getBundleForRemoteTransactor(String tName){
if(mCurrentBundleListing==null || mCurrentBundleListing.getBundles()==null){
return null;
}
Iterator<Map.Entry<String, BundleListing.BundleInfo>> iterator = mCurrentBundleListing.getBundles().entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, BundleListing.BundleInfo> entry = iterator.next();
BundleListing.BundleInfo bundleInfo = entry.getValue();
if(bundleInfo!=null && bundleInfo.remoteTransactors!=null && bundleInfo.remoteTransactors.containsKey(tName)) {
return bundleInfo.getPkgName();
}
}
return null;
}

public String getBundleForRemoteView(String rVname){
if(mCurrentBundleListing==null || mCurrentBundleListing.getBundles()==null){
return null;
}
Iterator<Map.Entry<String, BundleListing.BundleInfo>> iterator = mCurrentBundleListing.getBundles().entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, BundleListing.BundleInfo> entry = iterator.next();
BundleListing.BundleInfo bundleInfo = entry.getValue();
if(bundleInfo!=null && bundleInfo.remoteViews!=null && bundleInfo.remoteViews.containsKey(rVname)) {
return bundleInfo.getPkgName();
}
}
return null;
}

public String getBundleForComponet(String componentName){
if(mCurrentBundleListing==null || mCurrentBundleListing.getBundles()==null){
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ public static class BundleInfo{
public HashMap<String,Boolean> services;
public HashMap<String,Boolean> receivers;
public HashMap<String,Boolean> contentProviders;
public HashMap<String,String> remoteFragments;
public HashMap<String,String> remoteViews;
public HashMap<String,String> remoteTransactors;
public String unique_tag;
public long size;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
import android.taobao.atlas.bundleInfo.AtlasBundleInfoManager;
import android.taobao.atlas.bundleInfo.BundleListing;
import android.taobao.atlas.framework.bundlestorage.BundleArchive;
import android.taobao.atlas.patch.AtlasHotPatchManager;
import android.taobao.atlas.runtime.BundleUtil;
import android.taobao.atlas.runtime.ClassNotFoundInterceptorCallback;
import android.taobao.atlas.runtime.InstrumentationHook;
Expand Down Expand Up @@ -340,6 +341,7 @@ private Framework() {
*/
static void startup(boolean updated) throws BundleException {
AtlasBundleInfoManager.instance().getBundleInfo();
AtlasHotPatchManager.getInstance();
notifyFrameworkListeners(0 /* STARTING */, null, null);
notifyFrameworkListeners(FrameworkEvent.STARTED, null, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,7 @@ public synchronized void purge(final String uniqueTag, final long dexPatchVersio
File[] dexPatchs = dexPatchDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String filename) {
if(dexPatchVersion>0 && !filename.equals(dexPatchVersion+"")){
return true;
}
return false;
return !String.valueOf(dexPatchVersion).equals(filename);
}
});
if(dexPatchs!=null){
Expand Down
53 changes: 35 additions & 18 deletions atlas-core/src/main/java/android/taobao/atlas/hack/AndroidHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,24 +340,24 @@ public static Object createNewLoadedApk(Application application,Object activityT
}
}

private static Method findMethod(Object instance, String name,Class<?>... params) throws NoSuchFieldException {
for (Class<?> clazz = instance.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
try {
Method method = clazz.getDeclaredMethod(name, params);


if (!method.isAccessible()) {
method.setAccessible(true);
}

return method;
} catch (NoSuchMethodException e) {
// ignore and search next
}
}

throw new NoSuchFieldException("Field " + name + " not found in " + instance.getClass());
}
// private static Method findMethod(Object instance, String name,Class<?>... params) throws NoSuchFieldException {
// for (Class<?> clazz = instance.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
// try {
// Method method = clazz.getDeclaredMethod(name, params);
//
//
// if (!method.isAccessible()) {
// method.setAccessible(true);
// }
//
// return method;
// } catch (NoSuchMethodException e) {
// // ignore and search next
// }
// }
//
// throw new NoSuchFieldException("Field " + name + " not found in " + instance.getClass());
// }

/**
* Set classLoader to LoadedApk.mClassLoader and set LoadedApk.mApplication to null
Expand Down Expand Up @@ -553,6 +553,23 @@ public static Field findField(Object instance, String name) throws NoSuchFieldEx
throw new NoSuchFieldException("Field " + name + " not found in " + instance.getClass());
}

public static Method findMethod(Object instance, String name,Class<?>... args) throws NoSuchMethodException {
for (Class<?> clazz = instance.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
try {
Method method = clazz.getDeclaredMethod(name,args);

if (!method.isAccessible()) {
method.setAccessible(true);
}

return method;
} catch (NoSuchMethodException e) {
// ignore and search next
}
}
throw new NoSuchMethodException("Method " + name + " not found in " + instance.getClass());
}

public static Instrumentation getInstrumentation() throws Exception {
Object activityThread = getActivityThread();
if (activityThread == null) {
Expand Down
Loading

0 comments on commit 7de5c34

Please sign in to comment.