提交 6fa9ddd2 编写于 作者: 糕冷羊's avatar 糕冷羊

change[]: android发布1.1.7版本

上级 0fdd1c29
......@@ -3,7 +3,7 @@ apply plugin: 'com.novoda.bintray-release'
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit-no-op'
def publishVersionID = '1.1.6'
def publishVersionID = '1.1.7'
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
......
......@@ -12,7 +12,6 @@ android {
lintOptions {
abortOnError false
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}
......@@ -42,8 +41,6 @@ dependencies {
testImplementation 'junit:junit:4.12'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.zxing:core:3.3.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
......@@ -63,7 +63,7 @@ public class BlockListFragment extends BaseFragment implements OnBlockInfoUpdate
mBlockListAdapter.setOnItemClickListener(new BlockListAdapter.OnItemClickListener() {
@Override
public void onClick(BlockInfo info) {
mLogDetail.setText(info.toString() + info.toString() + info.toString());
mLogDetail.setText(info.toString());
mLogDetail.setVisibility(View.VISIBLE);
mBlockList.setVisibility(View.GONE);
mTitleBar.setTitle(getResources().getString(R.string.dk_kit_block_monitor_detail), false);
......
......@@ -12,7 +12,7 @@ import java.util.ArrayList;
*/
class MonitorCore implements Printer {
private static final String TAG = "MonitorCore";
private static final int BLOCK_THRESHOLD_MILLIS = 500;
private static final int BLOCK_THRESHOLD_MILLIS = 200;
private long mStartTime = 0;
private long mStartThreadTime = 0;
......
......@@ -7,12 +7,13 @@ import android.os.Debug;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.support.annotation.RequiresApi;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.view.Choreographer;
import android.widget.Toast;
import com.didichuxing.doraemonkit.R;
import com.didichuxing.doraemonkit.config.PerformanceInfoConfig;
......@@ -22,7 +23,6 @@ import com.didichuxing.doraemonkit.util.FileManager;
import com.didichuxing.doraemonkit.util.JsonUtil;
import com.didichuxing.doraemonkit.util.LogHelper;
import com.didichuxing.doraemonkit.util.threadpool.ThreadPoolProxyFactory;
import com.google.gson.JsonObject;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
......@@ -40,6 +40,7 @@ import java.util.Date;
public class PerformanceDataManager {
private static final String TAG = "PerformanceDataManager";
private static final float SECOND_IN_NANOS = 1000000000f;
private static final int MAX_FRAME_RATE = 60;
private static final int NORMAL_FRAME_RATE = 1;
private String filePath;
private String memoryFileName = "memory.txt";
......@@ -48,12 +49,10 @@ public class PerformanceDataManager {
private String customFileName = "custom.txt"; //自定义测试页面保存的文件名称
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private long mLastFrameTimeNanos;
private int mLastFrameRate;
private int mLastFrameRate = MAX_FRAME_RATE;
private int mLastSkippedFrames;
private float mLastCpuRate;
private float mLastMemoryInfo;
private String mPackageName;
private Handler mHandler;
private HandlerThread mHandlerThread;
private float mMaxMemory;
......@@ -69,23 +68,8 @@ public class PerformanceDataManager {
private static final int MSG_SAVE_LOCAL = 3;
private UploadMonitorInfoBean mUploadMonitorBean;
private boolean mUploading;
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
private Choreographer.FrameCallback mFrameCallback = new Choreographer.FrameCallback() {
@Override
public void doFrame(long frameTimeNanos) {
if (mLastFrameTimeNanos != 0L) {
long temp = frameTimeNanos - mLastFrameTimeNanos;
if (temp != 0) {
mLastFrameRate = Math.round(SECOND_IN_NANOS / (frameTimeNanos - mLastFrameTimeNanos));
mLastSkippedFrames = 60 - mLastFrameRate;
}
}
mLastFrameTimeNanos = frameTimeNanos;
Choreographer.getInstance().postFrameCallback(this);
writeFpsDataIntoFile();
}
};
private Handler mMainHandler = new Handler(Looper.getMainLooper());
private FrameRateRunnable mRateRunnable = new FrameRateRunnable();
private void executeCpuData() {
LogHelper.d(TAG, "current thread name is ==" + Thread.currentThread().getName());
......@@ -178,7 +162,6 @@ public class PerformanceDataManager {
mActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mAboveAndroidO = true;
mPackageName = context.getPackageName();
}
if (mHandlerThread == null) {
mHandlerThread = new HandlerThread("handler-thread");
......@@ -215,12 +198,14 @@ public class PerformanceDataManager {
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public void startMonitorFrameInfo() {
Choreographer.getInstance().postFrameCallback(mFrameCallback);
mMainHandler.postDelayed(mRateRunnable, DateUtils.SECOND_IN_MILLIS);
Choreographer.getInstance().postFrameCallback(mRateRunnable);
}
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public void stopMonitorFrameInfo() {
Choreographer.getInstance().removeFrameCallback(mFrameCallback);
Choreographer.getInstance().removeFrameCallback(mRateRunnable);
mMainHandler.removeCallbacks(mRateRunnable);
}
public void startMonitorCPUInfo() {
......@@ -467,4 +452,26 @@ public class PerformanceDataManager {
public float getMaxMemory() {
return mMaxMemory;
}
private class FrameRateRunnable implements Runnable, Choreographer.FrameCallback {
private int totalFramesPerSecond;
@Override
public void run() {
mLastFrameRate = totalFramesPerSecond;
if (mLastFrameRate > MAX_FRAME_RATE) {
mLastFrameRate = MAX_FRAME_RATE;
}
mLastSkippedFrames = MAX_FRAME_RATE - mLastFrameRate;
totalFramesPerSecond = 0;
mMainHandler.postDelayed(this, DateUtils.SECOND_IN_MILLIS);
}
@Override
public void doFrame(long frameTimeNanos) {
totalFramesPerSecond++;
Choreographer.getInstance().postFrameCallback(this);
writeFpsDataIntoFile();
}
}
}
......@@ -15,6 +15,10 @@ import com.didichuxing.doraemonkit.ui.crash.CrashCaptureAdapter;
import com.didichuxing.doraemonkit.ui.widget.titlebar.TitleBar;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class CrashCaptureFragment extends BaseFragment {
......@@ -46,8 +50,15 @@ public class CrashCaptureFragment extends BaseFragment {
File file = new File(CrashHandlerManager.getInstance().getFilePath());
if (file.exists()) {
ListView crash = findViewById(R.id.lv_crash);
final File[] listFiles = file.listFiles();
if (listFiles != null && listFiles.length != 0) {
final List<File> listFiles = Arrays.asList(file.listFiles());
if (listFiles != null && listFiles.size() != 0) {
Collections.sort(listFiles, new Comparator<File>() {
@Override
public int compare(File lhs, File rhs) {
return Long.valueOf(rhs.lastModified())
.compareTo(lhs.lastModified());
}
});
crash.setAdapter(new CrashCaptureAdapter(listFiles));
} else {
Toast.makeText(getContext(), R.string.dk_crash_capture_no_record, Toast.LENGTH_SHORT).show();
......@@ -56,7 +67,7 @@ public class CrashCaptureFragment extends BaseFragment {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Bundle bundle = new Bundle();
File listFile = listFiles[position];
File listFile = listFiles.get(position);
bundle.putSerializable(BundleKey.FILE_KEY, listFile);
showContent(CrashDetailFragment.class, bundle);
}
......
......@@ -59,6 +59,7 @@ public class CrashDetailFragment extends BaseFragment {
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
stringBuilder.append("\n");
}
inputStreamReader.close();
......
......@@ -155,7 +155,7 @@ public class CrashHandlerManager implements Thread.UncaughtExceptionHandler {
String value = entry.getValue();
sb.append(key + "=" + value + "\n");
}
sb.append("\n");
Writer writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
ex.printStackTrace(printWriter);
......
......@@ -5,11 +5,8 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.didichuxing.doraemonkit.R;
......
......@@ -11,6 +11,7 @@ import java.net.URLConnection;
import javax.net.ssl.HttpsURLConnection;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
/**
......@@ -31,6 +32,12 @@ public class AopUtils {
}
public static void addInterceptor(OkHttpClient.Builder builder) {
// 判断当前是否已经添加了拦截器,如果已添加则返回
for (Interceptor interceptor : builder.interceptors()) {
if (interceptor instanceof DoraemonInterceptor) {
return;
}
}
builder.addNetworkInterceptor(new DoraemonWeakNetworkInterceptor())
.addInterceptor(new DoraemonInterceptor());
}
......
......@@ -12,8 +12,6 @@ public class OkHttpAspect {
@After("execution(okhttp3.OkHttpClient.Builder.new(..))")
public void addInterceptor(JoinPoint joinPoint) {
if (joinPoint.getArgs() != null && joinPoint.getArgs().length > 0 && joinPoint.getArgs()[0] instanceof OkHttpClient) {
AopUtils.addInterceptor((OkHttpClient.Builder) joinPoint.getTarget());
}
AopUtils.addInterceptor((OkHttpClient.Builder) joinPoint.getTarget());
}
}
\ No newline at end of file
......@@ -9,22 +9,23 @@ import android.widget.TextView;
import com.didichuxing.doraemonkit.R;
import java.io.File;
import java.util.List;
public class CrashCaptureAdapter extends BaseAdapter {
private File[] files;
private List<File> files;
public CrashCaptureAdapter(File[] files) {
public CrashCaptureAdapter(List<File> files) {
this.files = files;
}
@Override
public int getCount() {
return files.length;
return files.size();
}
@Override
public Object getItem(int position) {
return files[position];
return files.get(position);
}
@Override
......@@ -42,7 +43,7 @@ public class CrashCaptureAdapter extends BaseAdapter {
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.setData(files[position].getName());
viewHolder.setData(files.get(position).getName());
return convertView;
}
......
......@@ -38,7 +38,7 @@ public class DoraemonStatisticsUtil {
try {
jsonObject.put("appId", appId);
jsonObject.put("appName", appName);
jsonObject.put("version", "1.1.6");
jsonObject.put("version", "1.1.7");
jsonObject.put("type", type);
jsonObject.put("from", from);
} catch (JSONException e) {
......
......@@ -36,6 +36,7 @@
android:layout_height="match_parent"
android:layout_gravity="top|left"
android:clickable="true"
android:textSize="@dimen/dk_font_size_14"
android:gravity="left"
android:visibility="gone"/>
</FrameLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@color/dk_color_FFFFFF"
android:layout_height="match_parent"
android:orientation="vertical">
<com.didichuxing.doraemonkit.ui.widget.titlebar.TitleBar
android:id="@+id/title_bar"
......@@ -11,13 +12,16 @@
android:layout_height="44dp"
app:dkLeftIcon="@drawable/dk_title_back"
app:dkLeftText="@string/dk_back"
app:dkTitle="@string/dk_crash_capture_summary_title" />
app:dkTitle="@string/dk_crash_capture_summary_title"/>
<View
style="@style/DK.Shadow.Bottom"/>
<ListView
android:id="@+id/lv_crash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" />
android:background="@android:color/white"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dk_color_FFFFFF"
android:orientation="vertical">
<com.didichuxing.doraemonkit.ui.widget.titlebar.HomeTitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="89dp"
app:dkIcon="@drawable/dk_close_icon_big"
app:dkTitle="@string/dk_kit_crash" />
app:dkTitle="@string/dk_kit_crash"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/setting_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"/>
</LinearLayout>
\ No newline at end of file
......@@ -17,14 +17,15 @@
app:dkLeftIcon="@drawable/dk_title_back"
app:dkLeftText="@string/dk_back"
app:dkTitle="@string/dk_crash_capture_summary_title" />
<View
style="@style/DK.Shadow.Bottom"/>
<TextView
android:id="@+id/tv_crash_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/dk_color_000000"
android:textSize="10sp" />
android:textSize="@dimen/dk_font_size_14" />
</LinearLayout>
......
......@@ -2,7 +2,8 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:background="@color/dk_color_FFFFFF"
android:layout_height="match_parent" >
<com.didichuxing.doraemonkit.ui.widget.titlebar.HomeTitleBar
android:id="@+id/title_bar"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dk_color_FFFFFF"
android:orientation="vertical">
<com.didichuxing.doraemonkit.ui.widget.titlebar.HomeTitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="89dp"
app:dkIcon="@drawable/dk_close_icon_big" />
app:dkIcon="@drawable/dk_close_icon_big"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/setting_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"/>
<View
android:layout_width="match_parent"
android:background="@color/dk_color_F5F6F7"
android:layout_height="12dp"/>
android:layout_height="12dp"
android:background="@color/dk_color_F5F6F7"/>
<LinearLayout
android:gravity="bottom|center_horizontal"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:gravity="bottom|center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/commit"
......@@ -34,6 +35,6 @@
android:layout_marginRight="15dp"
android:layout_marginBottom="15dp"
android:enabled="false"
android:text="@string/dk_platform_monitor_data_button" />
android:text="@string/dk_platform_monitor_data_button"/>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dk_color_FFFFFF"
android:orientation="vertical">
<com.didichuxing.doraemonkit.ui.widget.titlebar.HomeTitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="89dp"
app:dkIcon="@drawable/dk_close_icon_big" />
app:dkIcon="@drawable/dk_close_icon_big"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/setting_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"/>
</LinearLayout>
\ No newline at end of file
......@@ -13,7 +13,6 @@
app:dkIcon="@drawable/dk_close_icon_big"
app:dkTitle="@string/dk_kit_web_door" />
<View style="@style/DK.Divider" />
<RelativeLayout
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_crash_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableRight="@drawable/dk_more_icon"
android:textColor="@color/dk_color_333333" />
android:id="@+id/tv_crash_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableRight="@drawable/dk_more_icon"
android:padding="@dimen/dk_dp_15"
android:textColor="@color/dk_color_333333"
android:textSize="@dimen/dk_font_size_14"/>
......@@ -160,7 +160,7 @@
<string name="dk_align_info_text">位置:左%1$d 右%2$d 上%3$d 下%4$d</string>
<string name="dk_error_tips_permissions_less">请进行授权才可以使用功能</string>
<string name="dk_error_tips_permissions_less">请进行授权才可以使用功能</string>
//启动、跳转耗时
<string name="dk_item_time_counter_switch">Activity跳转耗时</string>
<string name="dk_item_time_goto_list">查看记录</string>
......
......@@ -3,7 +3,7 @@ apply plugin: 'com.novoda.bintray-release'
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit'
def publishVersionID = '1.1.6'
def publishVersionID = '1.1.7'
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册