Skip to content

Commit 79877c8

Browse files
committed
Upload file
1 parent 62233d6 commit 79877c8

37 files changed

Lines changed: 173 additions & 37 deletions

pio/src/main/AndroidManifest.xml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,15 @@
8282
<category android:name="android.intent.category.DEFAULT" />
8383
</intent-filter>
8484
</activity>
85-
<activity android:name=".OpenFileActivity">
86-
<intent-filter>
87-
<action android:name="android.intent.action.VIEW" />
88-
</intent-filter>
89-
</activity>
85+
<activity android:name=".OpenFileActivity">
86+
<intent-filter>
87+
<action android:name="android.intent.action.VIEW" />
88+
</intent-filter>
89+
</activity>
90+
<activity
91+
android:name=".CrashLogActivity"
92+
android:exported="false"
93+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
9094
<provider
9195
android:name=".MTDataFilesProvider"
9296
android:permission="android.permission.MANAGE_DOCUMENTS"
@@ -97,32 +101,29 @@
97101
<action android:name="android.content.action.DOCUMENTS_PROVIDER" />
98102
</intent-filter>
99103
</provider>
100-
<provider
101-
android:name="androidx.core.content.FileProvider"
102-
android:authorities="${applicationId}.provider"
103-
android:exported="false"
104-
android:grantUriPermissions="true">
105-
<meta-data
106-
android:name="android.support.FILE_PROVIDER_PATHS"
107-
android:resource="@xml/file_paths" />
108-
</provider>
109-
<receiver android:name=".ToastReceiver"
110-
android:enabled="true"
111-
android:exported="true">
112-
<intent-filter>
113-
<action android:name="${applicationId}.broadcast.MESSAGE" />
114-
</intent-filter>
115-
</receiver>
116-
117-
<service
118-
android:name=".WakeLockService"
119-
android:enabled="true"
120-
android:exported="false"
121-
android:foregroundServiceType="dataSync"
122-
android:stopWithTask="true" />
123-
124-
<service android:name=".NotiService"
125-
android:exported="true"/>
126-
104+
<provider
105+
android:name="androidx.core.content.FileProvider"
106+
android:authorities="${applicationId}.provider"
107+
android:exported="false"
108+
android:grantUriPermissions="true">
109+
<meta-data
110+
android:name="android.support.FILE_PROVIDER_PATHS"
111+
android:resource="@xml/file_paths" />
112+
</provider>
113+
<receiver android:name=".ToastReceiver"
114+
android:enabled="true"
115+
android:exported="true">
116+
<intent-filter>
117+
<action android:name="${applicationId}.broadcast.MESSAGE" />
118+
</intent-filter>
119+
</receiver>
120+
<service
121+
android:name=".WakeLockService"
122+
android:enabled="true"
123+
android:exported="false"
124+
android:foregroundServiceType="dataSync"
125+
android:stopWithTask="true" />
126+
<service android:name=".NotiService"
127+
android:exported="true"/>
127128
</application>
128129
</manifest>

pio/src/main/java/com/projectkr/shell/PIO.kt

Lines changed: 0 additions & 5 deletions
This file was deleted.
File renamed without changes.

pio/src/main/java/com/projectkr/shell/ActionPageOnline.kt renamed to pio/src/main/java/com/tool/tree/ActionPageOnline.kt

File renamed without changes.

pio/src/main/java/com/projectkr/shell/ActivityFileSelector.kt renamed to pio/src/main/java/com/tool/tree/ActivityFileSelector.kt

File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.tool.tree;
2+
3+
import android.app.AlarmManager;
4+
import android.app.PendingIntent;
5+
import android.content.Context;
6+
import android.content.Intent;
7+
import android.util.Log;
8+
9+
public class CrashHandler implements Thread.UncaughtExceptionHandler {
10+
11+
private final Context context;
12+
13+
public CrashHandler(Context context) {
14+
this.context = context.getApplicationContext();
15+
}
16+
17+
@Override
18+
public void uncaughtException(Thread thread, Throwable throwable) {
19+
20+
String stackTrace = Log.getStackTraceString(throwable);
21+
22+
Intent intent = new Intent(context, CrashLogActivity.class);
23+
intent.putExtra("crash_log", stackTrace);
24+
25+
PendingIntent pendingIntent = PendingIntent.getActivity(
26+
context,
27+
1001,
28+
intent,
29+
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE
30+
);
31+
32+
AlarmManager alarmManager =
33+
(AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
34+
35+
if (alarmManager != null) {
36+
alarmManager.set(
37+
AlarmManager.RTC,
38+
System.currentTimeMillis() + 200,
39+
pendingIntent
40+
);
41+
}
42+
43+
android.os.Process.killProcess(android.os.Process.myPid());
44+
System.exit(1);
45+
}
46+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.tool.tree;
2+
3+
import android.content.ClipData;
4+
import android.content.ClipboardManager;
5+
import android.content.Context;
6+
import android.content.Intent;
7+
import android.os.Bundle;
8+
import android.widget.Button;
9+
import android.widget.LinearLayout;
10+
import android.widget.ScrollView;
11+
import android.widget.TextView;
12+
import android.widget.Toast;
13+
14+
import androidx.appcompat.app.AppCompatActivity;
15+
16+
public class CrashLogActivity extends AppCompatActivity {
17+
18+
@Override
19+
protected void onCreate(Bundle savedInstanceState) {
20+
super.onCreate(savedInstanceState);
21+
22+
String log = getIntent().getStringExtra("crash_log");
23+
if (log == null) {
24+
log = "Không có dữ liệu log.";
25+
}
26+
27+
LinearLayout root = new LinearLayout(this);
28+
root.setOrientation(LinearLayout.VERTICAL);
29+
root.setPadding(20, 20, 20, 20);
30+
31+
Button copyBtn = new Button(this);
32+
copyBtn.setText("Copy log");
33+
34+
Button shareBtn = new Button(this);
35+
shareBtn.setText("Chia sẻ log");
36+
37+
ScrollView scrollView = new ScrollView(this);
38+
LinearLayout.LayoutParams scrollParams =
39+
new LinearLayout.LayoutParams(
40+
LinearLayout.LayoutParams.MATCH_PARENT,
41+
0,
42+
1f
43+
);
44+
scrollView.setLayoutParams(scrollParams);
45+
46+
TextView textView = new TextView(this);
47+
textView.setText(log);
48+
textView.setTextIsSelectable(true);
49+
textView.setTextSize(12);
50+
51+
scrollView.addView(textView);
52+
53+
root.addView(copyBtn);
54+
root.addView(shareBtn);
55+
root.addView(scrollView);
56+
57+
setContentView(root);
58+
59+
// COPY
60+
copyBtn.setOnClickListener(v -> {
61+
ClipboardManager clipboard =
62+
(ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
63+
64+
ClipData clip = ClipData.newPlainText("Crash Log", log);
65+
clipboard.setPrimaryClip(clip);
66+
67+
Toast.makeText(this, "Đã copy log", Toast.LENGTH_SHORT).show();
68+
});
69+
70+
// SHARE
71+
shareBtn.setOnClickListener(v -> {
72+
Intent shareIntent = new Intent(Intent.ACTION_SEND);
73+
shareIntent.setType("text/plain");
74+
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Crash Log");
75+
shareIntent.putExtra(Intent.EXTRA_TEXT, log);
76+
77+
startActivity(Intent.createChooser(shareIntent, "Chia sẻ log qua"));
78+
});
79+
}
80+
}
File renamed without changes.

0 commit comments

Comments
 (0)